package cn.lf.android.lawfirm;

import java.io.File;

import android.os.Environment;

public class App {
    public static final boolean isFree = false;
    public static File CACHE_DIR_IMAGE;
    public static int RESULT_CODE_CAMERA = 1;
    public static String CACHE_DIR;
    public static String CACHE_DIR_PRODUCTS;
    public static String CACHE_DIR_EXCEL;
    public static String CACHE_DIR_PDF;
    public static final String DirFileName = "lawfirm";

    public static void firstRun() {
        if (Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {//sd卡
            CACHE_DIR = Environment.getExternalStorageDirectory() + "/" + DirFileName;
        } else {
            CACHE_DIR = Environment.getRootDirectory().getAbsolutePath() + "/" + DirFileName;
        }
        CACHE_DIR_PRODUCTS = CACHE_DIR + "/files";
        File cacheDir = new File(App.CACHE_DIR);
        if (!cacheDir.exists()) {
            cacheDir.mkdirs();
        }
        File cacheDirProducts = new File(App.CACHE_DIR_PRODUCTS);
        if (!cacheDirProducts.exists()) {
            cacheDirProducts.mkdirs();
        }
    }

    public static String returnCacheDir() {
        firstRun();
        return CACHE_DIR_PRODUCTS;
    }
}
